<?php 
if($_REQUEST['cat'] > 0)
{ $items = getHFBSets($_REQUEST['cat']); }
else
{ $items = getHFBSets(); }
?>
<div class="menu_top">
	<input type="hidden" name="action" value="lista">
	<input type="submit" value="Add new set" class="buttons" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/new.gif'); border:1px solid #DDDDDD;" />&nbsp;&nbsp;
	Title:&nbsp;&nbsp;<input name="new_name[]" type="text" value="" maxlength="99" size="12">
	<input type="submit" value="Save" style="padding-left:20px; padding-right:10px;  background-image: url('../images/system/save.gif'); border:1px solid #DDDDDD; height:20px;" class="buttons">
</div>
<div class="menu_list">
<table id="menulist" class="item_list" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<th nowrap="nowrap">#&nbsp;Site ID&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Name&nbsp;&nbsp;</th>
        <th nowrap="nowrap">Wrap-Border&nbsp;&nbsp;</th>
        <th nowrap="nowrap">Header&nbsp;&nbsp;</th>
        <th nowrap="nowrap">Footer&nbsp;&nbsp;</th>
        <th nowrap="nowrap">Button&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Edit&nbsp;&nbsp;</th>
		<th nowrap="nowrap">Delete&nbsp;&nbsp;</th>
	</tr>
	<?php 
	if($items):
	foreach($items as $item)
	{
	?>
	<tr class="items">
		<td nowrap="nowrap">&nbsp;# <input type="hidden" name="hfb_id[]" value="<?php echo $item['id']; ?>" /> <?php echo $item['id']; ?></td>
		<td nowrap="nowrap"><input class="inp_txt" name="name[]" type="text" value="<?php echo $item['name']; ?>" maxlength="90" style="width:120px;" /></td>
        <td nowrap="nowrap">
        	<select name="border[]" style="width:100px;" onChange="submit();" >
				<option value="0">None</option>
				<?php 
				if($borders)
				{
					foreach($borders as $border)
					{
						if ($border['id'] == $item['border'])
						{
							echo '<option value="'.$border['id'].'" selected="selected">'.$border['name'].'</option>';
						}
						else
						{
							echo '<option value="'.$border['id'].'">'.$border['name'].'</option>';
						}
					}
				}
				?>
			</select>
        </td>
        <td nowrap="nowrap">
        	<select name="header[]" style="width:100px;" onChange="submit();" >
				<option value="0">None</option>
				<?php 
				if($headers)
				{
					foreach($headers as $header)
					{
						if ($header['id'] == $item['header'])
						{
							echo '<option value="'.$header['id'].'" selected="selected">'.$header['name'].'</option>';
						}
						else
						{
							echo '<option value="'.$header['id'].'">'.$header['name'].'</option>';
						}
					}
				}
				?>
			</select>
        </td>
        <td nowrap="nowrap">
        	<select name="footer[]" style="width:100px;" onChange="submit();" >
				<option value="0">None</option>
				<?php 
				if($footers)
				{
					foreach($footers as $footer)
					{
						if ($footer['id'] == $item['footer'])
						{
							echo '<option value="'.$footer['id'].'" selected="selected">'.$footer['name'].'</option>';
						}
						else
						{
							echo '<option value="'.$footer['id'].'">'.$footer['name'].'</option>';
						}
					}
				}
				?>
			</select>
        </td>
        <td nowrap="nowrap">
        	<select name="button[]" style="width:100px;" onChange="submit();" >
				<option value="0">None</option>
				<?php 
				if($buttons)
				{
					foreach($buttons as $button)
					{
						if ($button['id'] == $item['button'])
						{
							echo '<option value="'.$button['id'].'" selected="selected">'.$button['name'].'</option>';
						}
						else
						{
							echo '<option value="'.$button['id'].'">'.$button['name'].'</option>';
						}
					}
				}
				?>
			</select>
        </td>
		<td nowrap="nowrap">
			<a href="?con=<?php echo $_REQUEST['con']; ?>&item=<?php echo $item['id']; ?>"><img src="../images/system/templ.gif" border="0" /></a>&nbsp;
		</td>
		<td nowrap="nowrap"><input class="inp_image" type="image" name="delete" src="../images/system/trash_25.gif" value="0" onclick="this.value='<?php echo $item['id']; ?>'; edit_form.submit();" /></td>
	</tr>
	<?php
	}
	?>
</table>
</div>
<?php endif; ?>